home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1996 June / MACPOWER-1996-06.ISO.7z / MACPOWER-1996-06.ISO / AMUG / PROGRAMING_7 / Fat Module / Fat Module ト / GraphicsModule_Types.h < prev    next >
Text File  |  1994-07-28  |  4KB  |  155 lines

  1. /*
  2.     GraphicsModule_Types.h
  3.     
  4.     Data types and structures used by After Dark graphics modules.
  5.     
  6.     For more information, consult the programmer's section of the manual.
  7.      
  8.     By Patrick Beard and Bruce Burkhalter
  9.     
  10.     Copyright ゥ1989, 1990, 1991 Berkeley Systems, Inc.
  11. */
  12.  
  13. #ifndef __GRAPHICSMODULE_TYPES__
  14. #define __GRAPHICSMODULE_TYPES__
  15.  
  16. #ifndef __QUICKDRAW__
  17. #include <QuickDraw.h>
  18. #endif
  19.  
  20. /*
  21. #ifdef applec
  22.  
  23. #ifndef __SOUND__
  24. #include <Sound.h>
  25. #endif
  26.  
  27. #endif
  28.  
  29. #ifdef THINK_C
  30.  
  31. #include <SoundMgr.h>
  32.  
  33. #endif
  34. */
  35.  
  36. #if    THINK_C == 1
  37.  
  38. #include <SoundMgr.h>
  39.  
  40. #else
  41.  
  42. #ifndef __SOUND__
  43. #include <Sound.h>
  44. #endif
  45.  
  46. #endif
  47.  
  48.  
  49. /*
  50.     Messages that are passed to main() by After Dark:
  51.     
  52.     Initialize -        Allocate module's storage and get started.
  53.     Close -                Deallocate storage and shutdown.
  54.     Blank -                Blank out the screen (make it black).
  55.     DrawFrame -            Draw next frame of animation sequence.
  56.     ModuleSelected -    The module has specific processing to do when selected.
  57.     DoAbout -            Module can execute special code for an about message.
  58.     ButtonMessage -        Module wants to put up a dialog when a button is pressed.
  59.  */
  60.  
  61. typedef enum {
  62.     Initialize,
  63.     Close,
  64.     Blank,
  65.     DrawFrame,
  66.     ModuleSelected,
  67.     DoAbout,
  68.     ButtonMessage=8
  69. } GMMessage;
  70.  
  71. /* Return messages */
  72.  
  73. /*
  74.     The first three messages can be returned by DoInitialize(), DoClose(), DoBlank(), DoDrawFrame()
  75.     RefreshResources is valid only after a "SetUp" message.
  76.  */
  77.  
  78. enum {
  79.     ModuleError = -1,        /* After Dark will display the string params->errorMessage. */
  80.     RestartMe = 1,            /* After Dark will call main() with an "Initialize" message. */
  81.     ImDone,                    /* After Dark will not call main() again and take over drawing. */
  82.     RefreshResources        /* After Dark will redraw all controls after "SetUp" message. */
  83. };
  84.  
  85. /* bits in systemConfig that are special. */
  86.  
  87. #define MultiModuleRunning (1L << 10)        /* multimodule is present. */
  88. #define ModuleMayNotAnimate (1L << 9)        /* you may not animate. */
  89. #define SoundAvailable (1L << 15)            /* do we have sound? */
  90. #define ExtensionsAvailable (1L << 14)        /* are there extensions? */
  91.  
  92. /* types for looking at the monitors on the system. */
  93. struct MonitorData {
  94.     Rect    bounds;                            /* limiting rect of monitor (global coords) */
  95.     Boolean    synchFlag;                        /* flag set by monitor vbl task */
  96.     char    curDepth;                        /* current pixel depth */
  97. };
  98.  
  99. typedef struct MonitorData MonitorData, *MonitorDataPtr;
  100.  
  101. struct MonitorsInfo {
  102.     short        monitorCount;    /* number of monitors on system */
  103.     MonitorData    monitorList[1];    /* the monitors */
  104. };
  105.  
  106. typedef struct MonitorsInfo MonitorsInfo, *MonitorsInfoPtr;
  107.  
  108. /* copy of quickdraw globals */
  109. struct AD_QDGlobals {
  110.     GrafPtr        qdThePort;
  111.     Pattern        qdWhite;
  112.     Pattern        qdBlack;
  113.     Pattern        qdGray;
  114.     Pattern        qdLtGray;
  115.     Pattern        qdDkGray;
  116.     Cursor        qdArrow;
  117.     BitMap        qdScreenBits;
  118.     long        qdRandSeed;
  119. };
  120.  
  121. typedef struct AD_QDGlobals AD_QDGlobals, *AD_QDGlobalsPtr;
  122.  
  123. struct ExtensionElement {
  124.     OSType        selector;
  125.     Ptr            entryPoints;
  126. };
  127.  
  128. typedef struct ExtensionElement ExtensionElement;
  129.  
  130. struct ExtensionTable {
  131.     short                extensionCount;
  132.     ExtensionElement    extensionList[1];
  133. };
  134.  
  135. typedef struct ExtensionTable ExtensionTable, *ExtensionTablePtr;
  136.  
  137. /* the parameters passed in at every call to the graphics module */
  138. struct GMParamBlock {
  139.     short                controlValues[4];    /* the values of the user set sliders. */
  140.     MonitorsInfoPtr        monitors;            /* what monitors are connected and their depth. */
  141.     Boolean                colorQDAvail;        /* whether color is around. */
  142.     short                systemConfig;        /* bitmask of system configuration. */
  143.     AD_QDGlobalsPtr        qdGlobalsCopy;        /* read-only qd globals */
  144.     short                brightness;            /* message variable to tell NL to dim monitor */
  145.     Rect                demoRect;            /* rect of the Control Panel if in Demo Mode. */
  146.     StringPtr            errorMessage;        /* string to be displayed if error encountered. */
  147.     SndChannelPtr        sndChannel;            /* sound channel allocated for module's use. */
  148.     short                adVersion;            /* BCD After Dark version number. */
  149.     ExtensionTablePtr    extensions;            /* After Dark extensions table. */
  150. };
  151.  
  152. typedef struct GMParamBlock GMParamBlock, *GMParamBlockPtr;
  153.  
  154. #endif
  155.